<?php
	require_once("../PHP_includes/include.php");
	require_once("../system/objects/Message.php");
	if(!(isset($_GET["page"]) && $_GET["page"] == "login") && (!isset($_SESSION['user']) || !$_SESSION['user']->auth()))
	{
		$_GET["page"] = 'loginForm';
		include("pages/".$_GET["page"].".php");
	}
	elseif(isset($_GET["page"]) && $_GET["page"] != "")
	{
		if(file_exists("pages/".$_GET["page"].".php"))
		{
			include("pages/".$_GET["page"].".php");
		}
		else 
		{
			print("404");
			return;
		}
	}
	elseif(!isset($_GET["page"]) || $_GET["page"] != "")
	{
			$_GET["page"] = "message";
			include("pages/".$_GET["page"].".php");
	}
	else
	{
		$_GET["page"] = 'loginForm';
		include("pages/".$_GET["page"].".php");
	}
	$className = $_GET["page"]."page";
	$page = new $className();
	$page->getPage();
?>